package com.jzg.mvc.biz.storeBarcode;

import com.jfinal.core.Path;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Page;
import com.jzg.common.controller.BaseController;
import com.jzg.common.model.biz.StoreBarcode;

@Path(value = "/biz/barcode", viewPath = "/views/biz/barcode")
public class StoreBarcodeController extends BaseController {

	protected final Log LOG = Log.getLog(getClass());

	public void index() {
		render("list.html");
	}

	public void listData() {
		int pageNumber = getParaToInt("page", 1);
		int pageSize = getParaToInt("limit", 10);
		String keyword = getPara("keyword");
		String sqlExceptSelect = " FROM " + StoreBarcode.TABLE_NAME + " O  WHERE 1=1 ";
		if (!StrKit.isBlank(keyword)) {
			sqlExceptSelect += " AND ( O.NAME LIKE '%" + keyword + "%' ) ";
		}
		sqlExceptSelect += "  ORDER BY  O.CREATETIME DESC ";
		Page<StoreBarcode> page = StoreBarcode.dao.paginate(pageNumber, pageSize, "select O.*,(SELECT NAME FROM SYS_ORG WHERE ID=O.orgId ) orgName ", sqlExceptSelect);
		renderLayuiPage(0, page.getList(), "", page.getTotalRow());
	}
	
}
